package com.zorn.platform.user.action;

import com.zorn.core.provider.ActionSupportProvider;
import com.zorn.platform.user.service.IUserService;

public class UserAction extends ActionSupportProvider {

	/* Fields
	================================================== */
	private IUserService userService;

	public UserAction() {
		System.out.println("Instance ==========================" + this.getClass().getName());
	}

	/* Extension methods
	================================================== */
	public String login() {
		userService.login(getParameterMap());

		setJSONObject(userService.getResult());

		return JSON_RESULT;
	}

	public String logout() {
		userService.logout(getParameterMap());

		setJSONObject(userService.getResult());

		return JSON_RESULT;
	}

	public String getComponents() {
		userService.getComponents(getParameterMap());

		setJSONObject(userService.getResult());

		return JSON_RESULT;
	}

	/* Basic methods
	================================================== */
	public String query() {
		userService.query(getParameterMap());

		setJSONObject(userService.getResult());

		return JSON_RESULT;
	}

	public String count() {
		userService.count(getParameterMap());

		setJSONObject(userService.getResult());

		return JSON_RESULT;
	}

	public String insert() {
		userService.insert(getParameterMap());

		setJSONObject(userService.getResult());

		return JSON_RESULT;
	}

	public String update() {
		userService.update(getParameterMap());

		setJSONObject(userService.getResult());

		return JSON_RESULT;
	}

	public String delete() {
		userService.delete(getParameterMap());

		setJSONObject(userService.getResult());

		return JSON_RESULT;
	}

	/* Getters & Setters
	================================================== */
	public void setUserService(IUserService userService) {
		this.userService = userService;
	}

}